<?php

$params = array_merge(
        require(__DIR__ . '/../../common/config/params.php'), require(__DIR__ . '/../../common/config/params-local.php'), require(__DIR__ . '/params.php'), require(__DIR__ . '/params-local.php')
);

return [
    'id'                  => 'app-backend',
    'basePath'            => dirname(__DIR__),
    'controllerNamespace' => 'backend\controllers',
    'bootstrap'           => [ 'log' ],
    'modules'             => [],
    'components'          => [
        'user'         => [
            'identityClass'   => 'backend\models\Admin',
            'enableAutoLogin' => true,
        ],
        'log'          => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets'    => [
                    [
                    'class'  => 'yii\log\FileTarget',
                    'levels' => [ 'error', 'warning' ],
                ],
            ],
        ],
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],
        'urlManager'   => [
            'enablePrettyUrl' => true,
            'showScriptName'  => false,
            'rules'           => [
            ],
        ],
//        "view" => [
//            "theme" => [
//                "pathMap" => [
//                    "@app/views" => "@vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app"
//                ],
//            ],
//        ],
        "authManager"  => [ "class"        => 'yii\rbac\DbManager', //这里记得用单引号而不是双引号 
            "defaultRoles" => [ "guest" ], ],
    ],
//    'language' => 'zh_CN',
    'params'              => $params,
    'name'                => '后台管理',
    'modules'             => [
        'gii' => [
            'class'      => 'yii\gii\Module',
            'allowedIPs' => [ '127.0.0.1', '::1' ],
            'generators' => [
                'crud'  => [ //生成器名称 
                    'class'     => 'yii\gii\generators\crud\Generator',
                    'templates' => [ //设置我们自己的模板 
                        //模板名 => 模板路径 
                        'myCrud' => '@app/giitemplate/crud/default',
                    ]
                ],
                'model' => [ //生成器名称 
                    'class'     => 'yii\gii\generators\model\Generator',
                    'templates' => [ //设置我们自己的模板 
                        //模板名 => 模板路径 
                        'myModel' => '@app/giitemplate/model/default',
                    ]
                ]
            ],
        ],
        'admin' => [
            'class' => 'mdm\admin\Module',
//             'layout' => 'left-menu',//yii2-admin的导航菜单
        ]
    ],
    'language'=>'zh-CN',
    //严重警告！！！as access位置不要添加错了，已经不少同学都掉坑里了！！！
    'as access'           => [
        //ACF肯定是要加的，因为粗心导致该配置漏掉了，很是抱歉
        'class'        => 'mdm\admin\components\AccessControl',
        'allowActions' => [
            '*',
//            'site/*'
        //这里是允许访问的action
        //controller/action
        ]
    ],
];
